#pragma once
#ifndef PUBLIC_STRUCT_H
#define PUBLIC_STRUCT_H
#include <stdint.h>
const float  data_precision = 0.1f;

#pragma pack(push) // 将当前pack设置压栈保存
#pragma pack(1)// 必须在结构体定义之前使用

typedef struct
{
    uint32_t frame_head_syn; //帧识别码 1-4

    uint16_t frame_length;//帧长度 5-6
    uint16_t frame_type;//帧类型7-8
    //uint16_t frame_length;//帧长度

    uint8_t azimuth_start;//起始方位角9
    uint8_t azimuth_stop;//终止方位角10
    uint16_t sector_count;//扇区个数11-12

    uint16_t package_number;//包编号13-14
    uint16_t package_count;//包数15-16

    uint32_t frame_number;//从零开始 帧编号 17-20

    uint16_t trace_counts;//点迹个数21-22
    uint16_t sector_number;//扇区编号23-24

    uint32_t prf;//重频25-28
    uint32_t cpi_count;//CPI积累点数29-32
    uint32_t f0;//射频频点33-36
    uint32_t fangwei;//方位角37-40

    uint32_t beam_azi_id;//41-44
    uint32_t beam_pitch_id;//45-48

}FrameHeadTarget;//帧头协议

typedef struct
{
	//20230505 核对协议修改
	uint32_t 	distance;//距离；4
	int32_t  	azimuth;//方位（角度）；8
	int16_t     amplitude;//幅度；10
	uint16_t 	doppler;//多普勒通道号；12
	uint16_t 	dis_span;//跨越距离（块大小）；14
	int16_t  	SNR;//信噪比；16
	uint8_t 		doppler_span;//跨越多普勒通道数（块大小）；17
	uint8_t 		azimuth_span;//跨越方位（块大小）；18
	int16_t  	velocity;//速度；20
    int16_t  	height;//高度；22

    int16_t  	pitch;//俯仰；（角度）24


	int16_t  	pitch_span;//跨越俯仰（块大小）；26
	int16_t   	mean_noise;//噪声均值；28
	
	uint32_t 	year;//年32
	uint16_t 	month;//月34
	uint16_t 	day;//日36
	uint16_t 	hour;// 时38
	uint16_t 	minute;//分40
	uint32_t 	second;//秒//0.001秒44

	uint16_t 	beam_id;//波束编号；45，46
	bool 		clutter_enable;//杂波图区标志；
	uint8_t 	    shanqu;//预留；
}TargetData;

struct MagicNumberInfo
{
	//数据处理输出到显控帧头信息 大小54字节
	int Identifer;    //AAAAAAAA

	short FrameLength;  //12
	short FrameType;

	uint8_t azimuth_start;//起始方位角
    uint8_t azimuth_stop;//终止方位角
    uint16_t sector_count;//扇区个数

	short FrameSeq;
	int UDP_cnt=0;
	int UDP_Seq=0;

	short Sector_Seq;
	short Point_cnt;

	int reserve[7];
};

struct Point_In
{
	short Point_Seq;
	int Range;
	short Doppler;
	unsigned short Amplitude;
	short Azimuth;
	short SNR;
	short Height;
	short PitchAngle;
	short Noise;
};
struct Point_Out
{
	int Range;
	int point_cnt;
	short Doppler;
	short Azimuth;
	int CPISeq;
};
typedef struct Track_Out_CR
{
	int Track_ID;
	float Track_Range;                  //距离
	float Track_Azimuth;                //方位
	int Track_Height;                 //高度
	float pitchAngle;					//俯仰角
	float Track_Velocity;
	int point_type;                //补点：0  实点：1
	short time_tolive;
	int16_t mean_noise;
	float SNR;
    short year;//37-38
    short month;
    short day;
    short hour;
    short minute;
    short second;//48

    float Track_Range1;                  //距离
    float Track_Azimuth1;                //方位
    float pitchAngle1;
    float Track_Range2;                  //距离
    float Track_Azimuth2;                //方位
    float pitchAngle2;
    int track_seq;

}Track_Out_CR;

typedef struct Track_Out_ku
{
	int Track_ID;
	float Track_Range;                  //距离
	float Track_Azimuth;                //方位
	float Track_Height;                 //高度
	float pitchAngle;					//俯仰
	float Track_Velocity;               //速度
	double longitude;					//经度
	double latitude;						//纬度
	short year;							//年月日时分秒
	short month;
	short day;
	short hour;
	short minute;
	short second;
}Track_Out_ku;

struct MagicNumberHead_KU
{
	int Identifer;//58445a5a
	short length;//3e00
	short src_id;//0000
	short dst_id;//0000
	short reserve;//0000
	int commamdIdentifer;//00030002
	int udp_count;//0000 0001
	int udp_seq;//0000 0000
	unsigned int data_length;//0000 001c
};
struct MagicNumberTail_KU
{
	short CRC;
	int Identifer;//0x4F564552
};

struct point_KU
{
	short range;//0.1
	short azimuth;//0.01
	short pitchAngle;//0.01
	short height;//0.1       //现在改为了波位 应更改
	short velocity;//0.01
	short ampititude;//0.1

#if 1
	//short year;
	//short momth;
	//short day;
	short hour;
	short minute;
	int second;
#endif
};

//20230424
struct PointIn
{
	float Range;
	uint16_t Doppler;
    float v; //速度
	float Azimuth;
    float pitch;
	int Amplitude;
	int frame;
    int SNR;
    uint16_t shanqu;
	int16_t mean_noise;
    uint32_t    con_cnt;//关联计数
    uint32_t    arp_flag;//摆正标志位
    float    acp_sum;//方位和
    uint32_t dop_sum;//多普勒和
    uint16_t beam_id;//波束编号
//    float  fangwei;
    uint32_t 	year;//年32
    uint16_t 	month;//月34
    uint16_t 	day;//日36
    uint16_t 	hour;// 时38
    uint16_t 	minute;//分40
    uint32_t 	second;//秒//0.001秒44
    uint16_t  beam_id_azi;//方位波束编号
    uint16_t  beam_id_pitch;//俯仰波束编号
};




//
//int write_txt_uint(
//	std::string filename,
//	int id,
//	uint32_t longi,
//	uint32_t alt,
//	short hour,
//	short minute,
//	short second
//	)
//{
//	using namespace std;
//	//打开写入，只追加写，即只在文件末尾添加，不覆盖原先内容
//	ofstream outFile(filename, ios_base::out | ios_base::app);
//
//	if (!outFile.is_open())
//	{
//		std::cout << "file open failed" << std::endl;
//	}
//	else
//	{
//		//outFile << id << '\t' << longi << '\t' << alt << '\t' << hour << '\t' << minute << '\t' << second << '\t' << endl;
//	}
//
//	return 0;
//}


static float const_last_angle;

static int dotnum_choose_flag;

static int num = 0;

#define CHAHZI 0


#define HUIFANG 1
#define HIGH 70       //多旋翼设定的固定高度

#define Range_add 15//多旋翼矫正距离

#pragma pack(pop) 

#endif
